clear all
import spss using "/Users/tatianapaula/Desktop/My paper project/Data analysis/Survey A Cara da Democracia/2019/bdacara19_A Cara da Democracia 2019.sav", clear
gen year = 2019
keep sexo idade sit gc5 _v2 rcor esc partsimp relig satdem year gc6 gc7 gc9 gc13 gc14
gen female = (sexo==2)
gen male = (sexo==1)
rename idade age
rename gc5 TrustArmedForces
rename gc6 TrustChurches
rename gc9 TrustGovEmployee
rename gc13 TrustMilitaryPolice
rename gc14 TrustFederalPolice
rename _v2 income
drop if TrustArmedForces>5
drop if TrustChurches>5
drop if TrustGovEmployee>5
drop if TrustMilitaryPolice>5
drop if TrustFederalPolice>5
label variable TrustArmedForces
label define labels26 1 High 2 Medium 3 Low 4 DontTrust, modify
label define labels27 1 High 2 Medium 3 Low 4 DontTrust, modify
label define labels28 1 High 2 Medium 3 Low 4 DontTrust, modify
label define labels30 1 High 2 Medium 3 Low 4 DontTrust, modify
label define labels34 1 High 2 Medium 3 Low 4 DontTrust, modify
label define labels35 1 High 2 Medium 3 Low 4 DontTrust, modify
label define labels45 1 YES 2 NO, modify
gen DontTrust=1 if TrustArmedForces==3 | TrustArmedForces==4
replace DontTrust=0 if TrustArmedForces==1 | TrustArmedForces==2
gen DontTrustChurches=1 if TrustChurches==3 | TrustChurches==4
replace DontTrustChurches=0 if TrustChurches==1 | TrustChurches==2
gen DontTrustGovEmployee=1 if TrustGovEmployee==3 | TrustGovEmployee==4
replace DontTrustGovEmployee=0 if TrustGovEmployee==1 | TrustGovEmployee==2
gen DontTrustMilitaryPolice=1 if TrustMilitaryPolice==3 | TrustMilitaryPolice==4
replace DontTrustMilitaryPolice=0 if TrustMilitaryPolice==1 | TrustMilitaryPolice==1
gen DontTrustFederalPolice=1 if TrustFederalPolice==3 | TrustFederalPolice==4
replace DontTrustFederalPolice=0 if TrustFederalPolice==1 | TrustFederalPolice==2

gen white = rcor==3
gen black = rcor==1
gen other_race = rcor==2  | rcor==4 | rcor==5
gen grade12 = esc==1 | esc==2 | esc==3
gen grade13 = esc==2 | esc==3 | esc==4 | esc==5 | esc==6 
label variable partsimp "Currently likes one political party"
rename relig religion
label variable religion "religion"
gen Dissatisfaction=1 if satdem==3 | satdem==4
replace Dissatisfaction=0 if satdem==1 | satdem==2
drop if religion>11
save "/Users/tatianapaula/Desktop/My paper project/Data analysis/logit regression/2019", replace


**#
logit DontTrust Dissatisfaction white female age i.schooling partsimp evangelics catholics i.income, or

collect clear
collect create MyModels

collect _r_b _r_p,                    ///
        name(MyModels)                 		    ///
        tag(model[(1)])                			///
        :logit DontTrust Insatisfaction white female age schooling partsimp religion income

collect layout (colname#result) (model), name(MyModels)
collect style cell cell_type[item column-header], halign(center)
collect style header result, level(hide)
collect style column, extraspace(1)
putpdf clear
putpdf begin
collect style putpdf, width(60%) indent(1 in)                                ///
        title("Table 1: Likelihood of lower level of trust in Armed Forces if the repsondent is insatisfied with Democracy in Brazil (A Cara da Democracia - 2019)")  ///
        note("Standardized coefficients presented in OLS models; Odds ratios presented in Logits (p-values in parentheses)")
putpdf collect
putpdf save MyTable3.pdf, replace

